<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get formatterʼs timezone</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intldateformatter.getcalendarobject.html">IntlDateFormatter::getCalendarObject</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intldateformatter.islenient.html">IntlDateFormatter::isLenient</a></div>
 <div class="up"><a href="class.intldateformatter.html">IntlDateFormatter</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intldateformatter.gettimezone" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlDateFormatter::getTimeZone</h1>
  <h1 class="refname">datefmt_get_timezone</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PECL intl &gt;= 3.0.0)</p><p class="refpurpose"><span class="refname">IntlDateFormatter::getTimeZone</span> -- <span class="refname">datefmt_get_timezone</span> &mdash; <span class="dc-title">Get formatterʼs timezone</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-intldateformatter.gettimezone-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="class.intltimezone.html" class="type IntlTimeZone">IntlTimeZone</a></span> <span class="methodname"><strong>IntlDateFormatter::getTimeZone</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="class.intltimezone.html" class="type IntlTimeZone">IntlTimeZone</a></span> 
   <span class="methodname"><strong>datefmt_get_timezone</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  
  <p class="para rdfs-comment">
   Returns an <a href="class.intltimezone.html" class="classname">IntlTimeZone</a> object representing the
   timezone that will be used by this object to format dates and times. When
   formatting <a href="class.intlcalendar.html" class="classname">IntlCalendar</a> and
   <a href="class.datetime.html" class="classname">DateTime</a> objects with this
   <a href="class.intldateformatter.html" class="classname">IntlDateFormatter</a>, the timezone used will be the one
   returned by this method, not the one associated with the objects being
   formatted.
  </p>
  
 </div>

 
 <div class="refsect1 parameters" id="refsect1-intldateformatter.gettimezone-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-intldateformatter.gettimezone-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The associated <a href="class.intltimezone.html" class="classname">IntlTimeZone</a>
   object 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-intldateformatter.gettimezone-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2583">
    <p><strong>Example #1 <span class="function"><strong>IntlDateFormatter::getTimeZone()</strong></span> examples</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$madrid&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Europe/Madrid'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$lisbon&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Europe/Lisbon'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$madrid</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTimezone</span><span style="color: #007700">());<br />echo&nbsp;</span><span style="color: #0000BB">$madrid</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTimezone</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">getDisplayName</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">IntlTimeZone</span><span style="color: #007700">::</span><span style="color: #0000BB">DISPLAY_GENERIC_LOCATION</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"en_US"</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">$lisbon</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTimeZone</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">getId</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">//The&nbsp;id&nbsp;can&nbsp;also&nbsp;be&nbsp;retrieved&nbsp;with&nbsp;-&gt;getTimezoneId()<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">$lisbon</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTimeZoneId</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
object(IntlTimeZone)#4 (4) {
  [&quot;valid&quot;]=&gt;
  bool(true)
  [&quot;id&quot;]=&gt;
  string(13) &quot;Europe/Madrid&quot;
  [&quot;rawOffset&quot;]=&gt;
  int(3600000)
  [&quot;currentOffset&quot;]=&gt;
  int(7200000)
}
Spain Time
Europe/Lisbon
Europe/Lisbon

</pre></div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-intldateformatter.gettimezone-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="intldateformatter.gettimezoneid.html" class="function" rel="rdfs-seeAlso">IntlDateFormatter::getTimeZoneId()</a> - Get the timezone-id used for the IntlDateFormatter</span></li>
    <li class="member"><span class="function"><a href="intldateformatter.settimezone.html" class="function" rel="rdfs-seeAlso">IntlDateFormatter::setTimeZone()</a> - Sets formatterʼs timezone</span></li>
    <li class="member"><a href="class.intltimezone.html" class="classname">IntlTimeZone</a></li>
   </ul>
  </p>
 </div>

 
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intldateformatter.getcalendarobject.html">IntlDateFormatter::getCalendarObject</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intldateformatter.islenient.html">IntlDateFormatter::isLenient</a></div>
 <div class="up"><a href="class.intldateformatter.html">IntlDateFormatter</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
